home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / mail-tools / thor / thor_2.22 / thor.lha / rexx / SendMail.thor < prev    next >
Text File  |  1995-12-18  |  2KB  |  65 lines

  1. /* SendMail.thor by Troels Walsted Hansen <troelsh@powertech.no>
  2. ** $VER: SendMail.thor v1.00 (07.08.95)
  3. **
  4. ** This is a very simple script designed for use with AMosaic's new mailto:
  5. ** support.  Set ENV:Editor to your prefered editor (I use "GED Y"), and
  6. ** ENV:SendMail to "RX THOR:Rexx/SendMail.thor" (substitute "THOR:Rexx/" for
  7. ** the path where you put this script).
  8. **
  9. ** Now change the two variables below to whatever fits for your setup.
  10. ** MailSystem is the name of your TCP/SOUP/UUCP/whatever email system in
  11. ** THOR, and MailConfName is obviously the name of your email conference in
  12. ** THOR.
  13. **
  14. ** Sending a mailto: with AMosaic should now produce an EnterMsg event in THOR.
  15. ** The mail will be sent the next time you use Send Events from ConenctTHOR,
  16. ** upload your SOUP reply package, or whatever.
  17. **
  18. ** Note: THOR does not have to be running for this script to work!
  19. */
  20.  
  21. MailSystem = 'News&Mail'
  22. MailConfName = 'Email'
  23.  
  24. /* DON'T CHANGE ANYTHING BELOW HERE */
  25.  
  26. if ~show('p', 'BBSREAD') then do
  27.     address command
  28.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  29.         "WaitForPort BBSREAD"
  30. end
  31.  
  32. address(BBSREAD)
  33.  
  34. /* parse the header AMosaic provides */
  35.  
  36. str = readln('STDIN')
  37. EVENT.TOADDR = word(str, 2)
  38. EVENT.SUBJECT = substr(readln('STDIN'), 10)
  39. call readln('STDIN')
  40.  
  41. /* put the body of the message in a file with a unique name */
  42.  
  43. UNIQUEMSGFILE bbsname '"'MailSystem'"' stem UNIQUEFILE
  44. if(rc ~= 0) then exit
  45.  
  46. call open(tmp, UNIQUEFILE.NAME, W)
  47.  
  48. do until eof('STDIN')
  49.     call writeln(tmp, readln('STDIN'))
  50. end
  51.  
  52. call close(tmp)
  53.  
  54. /* fill out some more variables that BBSREAD require */
  55.  
  56. EVENT.CONFERENCE = MailConfName
  57. EVENT.MSGFILE = UNIQUEFILE.FILEPART
  58.  
  59. /* write the event */
  60.  
  61. WRITEBREVENT bbsname '"'MailSystem'"' event 0 stem EVENT
  62. if(rc ~= 0) then exit
  63.  
  64. exit
  65.